﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Manage_PrintUserInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Redirect("../HomePage/Default.aspx");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string name="", strSql;
        int i;
        Db db = new Db();
        System.Data.IDataReader dr;
        dr = db.DataReader("select accountid,pwd_bid from account  ");
        while (dr.Read())
        {
            name += dr["pwd_bid"].ToString() + "┆" + dr["accountid"] + "⊥";

        }
        dr.Close();
        dr.Dispose();
        for ( i = 0; i < name.Split('⊥').Length - 1; i++)
        {
            strSql = "@ update account set pwd_bid='" + SysFun.PasswordEncrypt(name.Split('⊥')[Int32.Parse(i.ToString())].Split('┆')[0]) + "' where accountid=" + name.Split('⊥')[Int32.Parse(i.ToString())].Split('┆')[1];
            if (strSql.Length > 0)
            {
                db.ExecuteTransaction(strSql.Substring(1).Split(new char[] { '@' }), 30);
            }
        }

        db.Close();
        Response.Write("<script>alert('添加成功" + i + "条记录！');</script>");

    }
}
